package de.uebungen.grabo;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


import javax.swing.JButton;

import de.fhwgt.dionarap.controller.DionaRapController;


public class ListenerBewegung implements ActionListener{

	@Override
	public void actionPerformed(ActionEvent arg0) {
		JButton btn = (JButton)arg0.getSource();
		Hauptfenster hafe = (Hauptfenster)(btn.getTopLevelAncestor().getParent());
		DionaRapController controller = (DionaRapController)hafe.getController();
				
		String stringZahl = arg0.getActionCommand();
	    int intZahl = Integer.parseInt(stringZahl);
				
	    controller.movePlayer(intZahl);
	    hafe.requestFocus();
	}

}
